Repository navigation
Ib collision optimization - #2201
Conversation
…g de-duplication step to GPU
|
Claude Code Review Head SHA: 7aa71ca Files changed:
Findings: |
|
Review of the full diff, read against the helpers it calls in master. I did not build or run it. Main point: the bitset is a fixed size and grows quadratically with the cap
Consequences:
The number of real contacts is linear in the body count (
I'd take option 1 at least before merging. What it does
Correctness: looks right
Other points
Minor
SummaryA sound change with a clear benefit, and I found no bug. Before merging I'd want the bitset sized from the run (or the quadratic cost documented), and the self-hosted GPU lanes run. Review written with Claude Code (AI-assisted). |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2201 +/- ##
==========================================
- Coverage 65.79% 65.75% -0.05%
==========================================
Files 111 111
Lines 30092 30496 +404
Branches 4582 4666 +84
==========================================
+ Hits 19799 20052 +253
- Misses 6609 6689 +80
- Partials 3684 3755 +71 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@sbryngelson I added option 1. Option 3 sounds better than it is, because it can result in many missed collisions. Our detection needs to be perfect for stability, so I have a dynamic setting for now. There is a world where the answer to all of our problems here is a nearest neighbor list, which would conveniently work with EL particles/bubbles as well. I would be interested to see what @thierrydaoud plans to add for those optimizations. Perhaps we can test both and see. I think this is important to merge for now, and then we can look into a proper refactor later in a way that avoids all of it. |
Lines of Code
|
|
@danieljvickers thanks for sizing the bitset from the run and making the index 64-bit; that settles the main point of the earlier review, and all the Frontier GPU lanes passed. Merging. One thing to keep in mind afterwards, not a blocker: Also a reminder that this and #2171 both rewrite the detection and force routines in Written with Claude Code (AI-assisted); read from the diff, not run. |
The collision optimization currently works fantastic in dilute particle suspensions, where the true number of collisions is quite low. There is a host-side deduplication loop that is sufficient when parsing 10s-100s of collision entries in the LUT. In dense suspensions, is quickly devolves into a host-side O($$N^2$$ ) detection, which I determined to actually be slower overall in this edge case. In our stress tests up until now, this was not tested when the list holds 100's of thousands of particle collision pairs. I have swapped the deduplication to a device-side version which maintains the per-particle filter, but runs 100x faster.
Below is shown a cae with a lop-sided distribution of particles in a sense suspension and the time spent per time step comparing the two LUTs on
masterand this branch.